package com.xuhaijian.controller;

import com.xuhaijian.entity.Order;
import com.xuhaijian.entity.OrderPayment;
import com.xuhaijian.service.OrderPaymentService;
import com.xuhaijian.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class TestController {

    @Autowired
    private OrderPaymentService orderPaymentService;

    @Autowired
    private OrderService orderService;

    @RequestMapping("/queryData/{applyNo}")
    //ZHSYC220000015
    public List<OrderPayment> queryData(@PathVariable("applyNo") String applyNo){
        return orderPaymentService.listByCondition(applyNo);
    }

    /**
     * 创建订单（客户端需生成唯一orderNo）
     */
    @PostMapping("order/create")
    public Long createOrder(@RequestBody Order order) {
        return orderService.saveOrder(order);
    }

}
